package nl.utwente.csc.obsl.diagram.extension.figure;


import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.sirius.diagram.ui.tools.api.figure.StyledFigure;

public class AbsentFigure extends Shape implements StyledFigure {

	
	 protected void outlineShape(final Graphics graphics) {
		 graphics.drawPolygon(getPointList());
	 }
	 
	 protected void fillShape(final Graphics graphics) {
		 graphics.fillPolygon(getPointList());
	 }
		 
	public AbsentFigure() {
	}	
	protected PointList getPointList() {
		final Rectangle r = new Rectangle();
		final PointList pointList = new PointList();
		r.x = bounds.x + getLineWidth() / 2;
		r.y = bounds.y + getLineWidth() / 2;
		r.width = bounds.width - getLineWidth();
		r.height = bounds.height - getLineWidth();
		pointList.removeAllPoints();
		
		final int space = 3;
		
		pointList.addPoint(r.x + space,                  r.y );
		pointList.addPoint(r.x + (r.width /2),           r.y + (r.height / 2)-space);
		pointList.addPoint(r.x + r.width - space,        r.y );
		pointList.addPoint(r.x + r.width,                r.y + space );
		pointList.addPoint(r.x + (r.width /2)+space,     r.y + (r.height / 2));
		pointList.addPoint(r.x + r.width,                r.y + r.height - space );
		pointList.addPoint(r.x + r.width - space,        r.y + r.height );
		pointList.addPoint(r.x + (r.width /2),           r.y + (r.height / 2)+space);
		pointList.addPoint(r.x +  space,                 r.y + r.height );
		pointList.addPoint(r.x,                          r.y + r.height - space);
		pointList.addPoint(r.x + (r.width /2)-space,     r.y + (r.height / 2));
		pointList.addPoint(r.x,                          r.y + space);
		return pointList;
	}
	
	

}